package com.yanqu.road.entity.beautyescort;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

@FieldTypeAnnotation(tableName = "t_c_escort_user")
public class EscortUserData extends DataObject {

    @FieldTypeAnnotation(select = true, update = true, desc = "玩家id")
    private long userId;

    @FieldTypeAnnotation(desc = "区服id")
    private long serverId;

    @FieldTypeAnnotation(desc = "总魅力值")
    private long totalGlamour;

    @FieldTypeAnnotation(desc = "商会等级")
    private int unionLv;

    @FieldTypeAnnotation(desc = "委托人")
    private List<Integer> clientList = new ArrayList<>();

    @FieldTypeAnnotation(desc = "地图玩家")
    private Map<Integer, Long> roadMapUser = new ConcurrentHashMap<>();

    @FieldTypeAnnotation(desc = "地图玩家-NPC")
    private Map<Integer, EscortBeautyMapNpc> roadMapNPCUser = new ConcurrentHashMap<>();

    @FieldTypeAnnotation(desc = "最后读取战报时间-红点")
    private int lastReadReportTime;

    @FieldTypeAnnotation(desc = "本周劫过我的人")
    private List<Long> enemyList = new ArrayList<>();

    @FieldTypeAnnotation(desc = "重置时间(每周)")
    private long resetTime;

    @FieldTypeAnnotation(desc = "重置时间(每天)")
    private long dayResetTime;

    @FieldTypeAnnotation(desc = "今日事件数")
    private int dayEventNum;

    @FieldTypeAnnotation(desc = "扩展参数")
    private UserDataParams params = new UserDataParams();

    @FieldTypeAnnotation(desc = "攻击记录")
    private Map<Long, EscortAttackRecord> attackRecord = new HashMap<>();

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        if(this.userId != userId) {
            this.userId = userId;
            setUpdateOption();
        }
    }

    public long getServerId() {
        return serverId;
    }

    public void setServerId(long serverId) {
        if(this.serverId != serverId) {
            this.serverId = serverId;
            setUpdateOption();
        }
    }

    public long getTotalGlamour() {
        return totalGlamour;
    }

    public void setTotalGlamour(long totalGlamour) {
        if(this.totalGlamour != totalGlamour) {
            this.totalGlamour = totalGlamour;
            setUpdateOption();
        }
    }

    public int getUnionLv() {
        return unionLv;
    }

    public void setUnionLv(int unionLv) {
        if(this.unionLv != unionLv) {
            this.unionLv = unionLv;
            setUpdateOption();
        }
    }

    public List<Integer> getClientList() {
        return clientList;
    }

    public void setClientList(List<Integer> clientList) {
        if(this.clientList != clientList) {
            this.clientList = clientList;
            setUpdateOption();
        }
    }

    public Map<Integer, Long>  getRoadMapUser() {
        return roadMapUser;
    }

    public void setRoadMapUser(Map<Integer, Long>  roadMapUser) {
        this.roadMapUser = roadMapUser;
        setUpdateOption();
    }

    public Map<Integer, EscortBeautyMapNpc> getRoadMapNPCUser() {
        return roadMapNPCUser;
    }

    public void setRoadMapNPCUser(Map<Integer, EscortBeautyMapNpc> roadMapNPCUser) {
        this.roadMapNPCUser = roadMapNPCUser;
        setUpdateOption();
    }

    public int getLastReadReportTime() {
        return lastReadReportTime;
    }

    public void setLastReadReportTime(int lastReadReportTime) {
        if(this.lastReadReportTime != lastReadReportTime) {
            this.lastReadReportTime = lastReadReportTime;
            setUpdateOption();
        }
    }

    public List<Long> getEnemyList() {
        return enemyList;
    }

    public void setEnemyList(List<Long> enemyList) {
        this.enemyList = enemyList;
        setUpdateOption();
    }

    public void addEnemy(long userId){
        if(!this.enemyList.contains(userId)){
            this.enemyList.add(userId);
            setUpdateOption();
        }
    }

    public void removeEnemy(long userId){
        if(this.enemyList.contains(userId)){
            this.enemyList.remove(userId);
            setUpdateOption();
        }
    }

    public long getResetTime() {
        return resetTime;
    }

    public void setResetTime(long resetTime) {
        if(this.resetTime != resetTime) {
            this.resetTime = resetTime;
            setUpdateOption();
        }
    }

    public long getDayResetTime() {
        return dayResetTime;
    }

    public void setDayResetTime(long dayResetTime) {
        if(this.dayResetTime != dayResetTime) {
            this.dayResetTime = dayResetTime;
            setUpdateOption();
        }
    }

    public int getDayEventNum() {
        return dayEventNum;
    }

    public void setDayEventNum(int dayEventNum) {
        if(this.dayEventNum != dayEventNum) {
            this.dayEventNum = dayEventNum;
            setUpdateOption();
        }
    }

    public UserDataParams getParams() {
        return params;
    }

    public void setParams(UserDataParams params) {
        if(this.params != params) {
            this.params = params;
            setUpdateOption();
        }
    }

    public Map<Long, EscortAttackRecord> getAttackRecord() {
        return attackRecord;
    }

    public void setAttackRecord(Map<Long, EscortAttackRecord> attackRecord) {
        this.attackRecord = attackRecord;
    }
}
